package com.doupi.partner.util;

import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import java.io.Serializable;
import java.util.Date;
import java.util.Map;

/**
 * API请求类
 */
public class AjaxRequest implements Serializable {

	private static final long serialVersionUID = -8902704508217679817L;
	/**
	 * 请求的时间
	 */
	private Date requestTime;

	/**
	 * 业务
	 */
	private String biz;

	/**
	 * 登录token 带有用户信息
	 */
	private String token;

	/**
	 * TODO 平台code 平台 HTML5 ANDROID IOS PC WEB
	 */
	private String platform;

	/**
	 * 请求的ip
	 */
	private String ip;

	/**
	 * JWT对象数据
	 */
	private Object jwt;

	/**
	 * 请求数据
	 */
	private Map<String, String> data;

	public Date getRequestTime() {
		return requestTime;
	}

	public void setRequestTime(Date requestTime) {
		this.requestTime = requestTime;
	}

	public String getBiz() {
		return biz;
	}

	public void setBiz(String biz) {
		this.biz = biz;
	}

	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

	public String getPlatform() {
		return platform;
	}

	public void setPlatform(String platform) {
		this.platform = platform;
	}

	public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}

	public Object getJwt() {
		return jwt;
	}

	public void setJwt(Object jwt) {
		this.jwt = jwt;
	}

	public Map<String, String> getData() {
		return data;
	}

	public void setData(Map<String, String> data) {
		this.data = data;
	}

	@Override
	public int hashCode() {
		return HashCodeBuilder.reflectionHashCode(this);
	}

	@Override
	public boolean equals(Object obj) {
		return EqualsBuilder.reflectionEquals(this, obj);
	}

	@Override
	public String toString() {
		return ToStringBuilder.reflectionToString(this, ToStringStyle.JSON_STYLE);
	}
}
